package cn.chainco.cts.jdo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

//工作单费用
@Entity
@Table(name = "cts_workfee")
public class WorkFee implements Serializable {
	private static final long serialVersionUID = -872914351261208659L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "workId")
	private Work work; // 工作单id

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "workItemId")
	private WorkItem workItem; // 应付费用对应的作业项目

	@Column(nullable = false)
	private Integer type; // 0.应收款，1.应付款，2.奖励

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "employeeId1")
	private Employee employee1; // 付款方/收款方/被奖励人

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "employeeId2")
	private Employee employee2; // 代收方/待付方

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "feeId")
	private Fee fee; // 费用名称id

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "currencyId")
	private Currency currency; // 币种id

	@Column
	private Float quantity; // 数量

	@Column
	private Float unitPrice;// 单价

	@Column(precision = 2)
	private Float money = 0f;// 应收金额

	@Column(precision = 2)
	private Float writtenOffmoney = 0f;// 已结算金额

	@Column(precision = 2)
	private Float notWrittenOffmoney = 0f;// 未核销金额

	@Column(length = 100)
	private String remark; // 说明

	@Column
	private Float quotaReward; // 定额奖励

	@Column
	private Float ratioReward; // 比例奖励

	@Column
	private Float totalReward; // 奖励总额

	@Temporal(TemporalType.TIMESTAMP)
	private Date rewardTime; // 结算时间

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Work getWork() {
		return work;
	}

	public void setWork(Work work) {
		this.work = work;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Employee getEmployee1() {
		return employee1;
	}

	public void setEmployee1(Employee employee1) {
		this.employee1 = employee1;
	}

	public Employee getEmployee2() {
		return employee2;
	}

	public void setEmployee2(Employee employee2) {
		this.employee2 = employee2;
	}

	public Fee getFee() {
		return fee;
	}

	public void setFee(Fee fee) {
		this.fee = fee;
	}

	public Currency getCurrency() {
		return currency;
	}

	public void setCurrency(Currency currency) {
		this.currency = currency;
	}

	public Float getQuantity() {
		return quantity;
	}

	public void setQuantity(Float quantity) {
		this.quantity = quantity;
	}

	public Float getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(Float unitPrice) {
		this.unitPrice = unitPrice;
	}

	public Float getMoney() {
		return money;
	}

	public void setMoney(Float money) {
		this.money = money;
	}

	public Float getWrittenOffmoney() {
		return writtenOffmoney;
	}

	public void setWrittenOffmoney(Float writtenOffmoney) {
		this.writtenOffmoney = writtenOffmoney;
	}

	public Float getNotWrittenOffmoney() {
		return notWrittenOffmoney;
	}

	public void setNotWrittenOffmoney(Float notWrittenOffmoney) {
		this.notWrittenOffmoney = notWrittenOffmoney;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Float getQuotaReward() {
		return quotaReward;
	}

	public void setQuotaReward(Float quotaReward) {
		this.quotaReward = quotaReward;
	}

	public Float getRatioReward() {
		return ratioReward;
	}

	public void setRatioReward(Float ratioReward) {
		this.ratioReward = ratioReward;
	}

	public Float getTotalReward() {
		return totalReward;
	}

	public void setTotalReward(Float totalReward) {
		this.totalReward = totalReward;
	}

	public Date getRewardTime() {
		return rewardTime;
	}

	public void setRewardTime(Date rewardTime) {
		this.rewardTime = rewardTime;
	}

	public WorkItem getWorkItem() {
		return workItem;
	}

	public void setWorkItem(WorkItem workItem) {
		this.workItem = workItem;
	}

}
